<%@page import="java.io.PrintWriter"%>
<%@ page language="java" import="java.util.*,java.sql.*"
	pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName

			() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>点卡管理</title>
<script src="../js/jquery-2.1.4.js"></script>

<link rel="stylesheet" href="../css/lanrenzhijia.css" media="all">
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css"
	rel="stylesheet">
<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script>
	jQuery(document).ready(function($) {
		$('.theme-login').click(function() {
			$('.theme-popover-mask').fadeIn(100);
			$('.theme-popover').slideDown(200);
		});
		$('.theme-poptit .close').click(function() {
			$('.theme-popover-mask').fadeOut(100);
			$('.theme-popover').slideUp(200);
		});

	});
	$(document).ready(function() {
		$('.user3').click(function() {
			$('#usernumber').attr("value", $(this).attr('id'));
		});
	});
</script>
</head>
<body>
	<div style="padding-left: 15px; height: auto; width: 99%;">
		<h1>点卡管理</h1>
		<hr>
		<!-- 
		<font size="5"><a href="add_product.jsp">添加商品</a>&nbsp;&nbsp;<a
			href="query_product.jsp">查询</a>&nbsp;&nbsp;</font>
			 -->
		<div>
			<form action="card_number_list_delete.jsp" method="post">
				<table class="table table-bordered">
					<thead>
						<tr>
							<th><input type="checkbox" id="all"></th>
							<th>卡号</th>
							<th>密码</th>
							<th>金额</th>
							<th>点数</th>
							<th>过期日期</th>
							<th>购买状态</th>
							<th>使用状态</th>
							<th>状态</th>
							<th>修改</th>
							<th>删除</th>
						</tr>
					</thead>

					<tbody>
						<%
							ResultSet rs = null;
							Statement statement = null;
							try {
								Driver driver = new com.mysql.jdbc.Driver();
								DriverManager.registerDriver(driver);
								Connection connection = DriverManager
										.getConnection(
												"jdbc:mysql://www.ccjjltx.cn:3307/numbersystem?useUnicode=true&characterEncoding=utf8",
												"root", "usbw");
								String sql = "select * from clickcard"; //创建执行语句
								statement = connection.createStatement();
								rs = statement.executeQuery(sql);

								while (rs.next()) {
						%>
						<tr>
							<td><input type="checkbox" id="input_number" name="numbers"
								value="<%=rs.getInt("CardNumber")%>"></td>

							<td><%=rs.getInt("CardNumber")%></td>
							<td><%=rs.getString("CardPassword")%></td>
							<td><%=rs.getFloat("Money")%></td>
							<td><%=rs.getInt("Point")%></td>
							<td><%=rs.getDate("TimeOutDate")%></td>
							<td><%=rs.getInt("isBuy")%></td>
							<td><%=rs.getInt("isUse")%></td>
							<td><%=rs.getInt("status")%></td>

							<td><a style="background-color: fff; border: 0"
								class="btn btn-primary btn-large theme-login" id="edit"
								name="<%=rs.getInt("CardID")%>" href="javascript:;%>"> <input
									type="button" style="background-color: fff; border: 0"
									class="user3" id="<%=rs.getInt("CardID")%>" value="修改"></a></td>
							<td><a
								href="card_delete_do.jsp?card_id=<%=rs.getInt("CardID")%>">删除</a></td>
						</tr>
						<%
							}

							} catch (Exception e) {
								e.printStackTrace();
							}
						%>
						<tr>
							<td><input type="submit"
								style="background-color: fff; border: 0" value="删除所选中项"></td>
								
						</tr>
					</tbody>
				</table>

			</form>
		</div>
	</div>

	<script>
		$(document)
				.ready(
						function() {

							$('#all').click(
									function() {
										$('input:checkbox[name]').prop(
												'checked', this.checked);
									});

							$('input:checkbox[name]')
									.click(
											function() {
												isall = $('input:checkbox[name]').length == $('input:checkbox[name]:checked').length;
												$('#all')
														.prop('checked', isall);
											});
						});
	</script>

	<div class="theme-popover">
		<div class="theme-poptit">
			<a href="javascript:;" title="关闭" class="close">×</a>
			<h3></h3>
		</div>
		<div class="theme-popbod dform">
			<form class="theme-signin" name="loginform"
				action="card_update_do.jsp" method="post">
				<ol>
					<li><strong>卡号：</strong><input class="ipt" type="text"
						name="CardNumber" value="" size="20" /></li>
					<li><strong>密码：</strong><input class="ipt" type="text"
						name="CardPassword" value="" size="20" /></li>
					<li><strong>金额：</strong><input class="ipt" type="text"
						name="Money" value="" size="20" /></li>
						<li><strong>点数：</strong><input class="ipt" type="text"
						name="Point" value="" size="20" /></li>
					<!--  
					<li><input class="ipt" type="hidden" id="main_id"
						name="main_id" /></li>
						-->
					<li><input class="btn btn-primary" type="submit" name="submit"
						value=" 修改 " /></li>
				</ol>
			</form>
		</div>
	</div>

</body>
</html>
